---
title: Preview a document via xPression
summary: Renders a document to PDF bytes for preview using the xPression Design SOAP service.
status: draft
owner: SAIF Case Management
last_reviewed: 2026-08-21
library: SAIF.Services.Printing
reference_type: embedded
operation_id: OP-PRINT-PREVIEW
trigger: Caller invokes clsPrint.previewDocument or clsPrint.previewPDF
---

# Preview a document via xPression

Renders an xPression Design document/package into PDF bytes for preview, without printing or distributing it.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-PRINT-PREVIEW |
| **Trigger** | Caller calls `previewDocument(package, xml)` (overload) or the parameterless `previewDocument()`/`previewPDF()` after setting `Package`/`XML` properties |
| **Inputs** | `Package` (trimmed, `.pkg` extension stripped if present), `XML`, `OutputProfile`, `Application` |
| **Outputs** | Rendered document bytes (`Byte()`, PDF) |
| **Primary components** | `clsPrint.previewDocument`, `clsPrint.previewPDF` |
| **Entry point** | `SAIF.Services.Printing\clsPrint.vb` |

## Steps

1. Caller sets `Package` (trims value, strips a trailing `.pkg` extension if present) and `XML` properties, or calls the overload that sets them directly.
2. `previewDocument()` (private, parameterless) delegates to `m_Xpresso.previewDocument(m_Package, m_XML, m_OutputProfile, m_Application)` — a synchronous SOAP call to the `xpresso.clsGenerate` proxy.
   > **Origin**: This step is implemented in `xpresso.clsGenerate` (`SAIF.Services.Printing.xpresso`, auto-generated SOAP client proxy) and executed against the external xPression Design server; no further local step trace is available for the external service call.*
3. `previewPDF` follows the same pattern but calls `m_Xpresso.previewPDF(...)` and forces `Application = "xPression Design"`.
4. Returns the rendered document as a `Byte()` array (PDF bytes) to the caller; no local persistence or business-rule enforcement occurs in this operation.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller sets Package/XML]) --> Call[Call m_Xpresso.previewDocument or previewPDF]
	Call --> Soap[SOAP call to external xPression server]
	Soap --> Return([Return PDF bytes])
```

## Failure and edge-case behavior
- No local validation of `Package`/`XML` occurs beyond trimming and `.pkg` suffix stripping.
- SOAP faults from the external xPression server propagate directly to the caller; no local exception handling wraps this call.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Services.Printing\clsPrint.vb`
- `SAIF.Services.Printing\Web References\xpresso\Reference.vb`
